package com.sec.bnjey.bluetooth;

import java.io.IOException;

public class OBDException extends IOException {

	public static final int CHECKSUM = 0x01;
	public static final int COMMAND = 0x02;
	public static final int PROTOCOL = 0x03;
	public static final int COMM = 0x04;
	public static final int NOT_SUPPORT = 0x05;
	public static final int LENGTH = 0x06;
	public static final int UPGRADE = 0x07;

	private int exceptionType;
	/**
	 * 
	 */
	private static final long serialVersionUID = 1791118814131789465L;

	public OBDException(int type) {
		exceptionType = type;
	}

	public String getMessage() {
		switch (exceptionType) {
		case CHECKSUM:
			return "CHECKSUM";
		case COMMAND:
			return "COMMAND";
		case PROTOCOL:
			return "PROTOCOL";
		case COMM:
			return "COMM";
		case NOT_SUPPORT:
			return "NOT_SUPPORT";
		case LENGTH:
			return "LENGTH";
		case UPGRADE:
			return "UPGRADE";
		}
		return "";
	}

	public int getType() {
		return exceptionType;
	}
}
